#ifndef TILED_INTERPOLATOR_H
#define TILED_INTERPOLATOR_H

#include "Interpolator.h"

class TiledInterpolator : public Interpolator {
  public:
    // Describes tiling behaviour at each edge.
    enum EdgeMode {
      HOLD,
      LOOP,
    };

    // Construct with edge modes.
    TiledInterpolator(EdgeMode horizontal_edge, EdgeMode vertical_edge);
    virtual ~TiledInterpolator();

    // Accesses a pixel in an image, applying edge behaviour settings.
    Color access(const ReadableImage& image, int i, int j) const;
    // Wrap or hold based on specified behaviour.
    static int constrain(int x, int max, EdgeMode mode);

  private:
    EdgeMode horizontal_edge_;
    EdgeMode vertical_edge_;
};

#endif
